package com.suitsoft.bdms.service.system;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.suitsoft.bdms.commos.UserHolder;
import com.suitsoft.bdms.dao.commos.PointDao;
import com.suitsoft.bdms.entity.account.User;
import com.suitsoft.bdms.entity.system.PointEntity;

/**
 * 单点登陆信息管理 
 *@author Suine
 */
@Service
@Transactional
public class PointInfoManager {
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	
	@Autowired
	private PointDao dao;
	
	public void save(PointEntity entity){
		User user = new User();
		user.setId(UserHolder.getLoginUser().getId());
		entity.setLastDate(new Date());
		entity.setLastUser(user);
		dao.save(entity);
	}
	
	public List<PointEntity> getAll(){
		return dao.getAll();
	}
	
	public PointEntity get(Long id){
		return dao.get(id);
	}
}

